#ifndef _BINDINGS_H_
#define _BINDINGS_H_

#include "Any.h"

namespace R {
	class Symbol;

	class Binding {
		public:
			Symbol* key;
			Any*    value;
	};

	class Bindings : public Any {
		static RVirtualTable* virtualVT;
		friend class REnvs;

	public:
		uint64_t size;

	private:
		uint64_t capacity;
		Binding  content[1];

	public:
		static Bindings* create(uint64_t initalCapacity, uint64_t initialSize=0);

		Bindings* expand(Symbol *sym, Any *value, uint64_t* idx=0);
		uint64_t  resolve(Symbol *sym);
		void      remove(uint64_t idx);
		void      set(uint64_t idx, Symbol*key, Any *value);
		void      set(uint64_t idx, Any *value);

		Symbol*   key(uint64_t idx);
		Any*      get(uint64_t idx);
		
		void      tracer(word_t closure);

		void      print();
	};
}

#endif
